# -*- coding: utf-8 -*-

import sys
from PyQt5 import uic
from PyQt5.QtWidgets import QMainWindow,QApplication
class Myapp(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)      
        uic.loadUi("calc_tax_ui.ui",self)
        self.pushButton.clicked.connect(self.calc_tax)
        self.show()
        
    def calc_tax(self):
        wages = int(self.text_wages.toPlainText())
        insurance = int(self.text_insurance.toPlainText())
        help(self.text_insurance.toPlainText)
        income_tax = round(max(max(map(lambda x,y:(wages - insurance -3500)*x - y,[0.03,0.1,0.2,0.25,0.3,0.35,0.45],[0,105,555,1005,2755,5505,13505])),0),2)
        income_tax_string = "您应交的个人所得税是： %s" %income_tax
        self.text_result.setText(income_tax_string)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Myapp() 
    sys.exit(app.exec_())